import { reqhomebanner, reqhomecate } from "../../../../../笔记案例/day11/code/app-ui/src/http/http"

let state = {
    cate: [],
    banner: []
}
let getters = {
    cate({ cate }) {
        return cate
    },
    banner({ banner }) {
        return banner
    }
}
let mutations = {
    changeCate(state, cate) {
        state.cate = cate
    },
    changeBanner(state, banner) {
        state.banner = banner
    }
}
let actions = {
    reqcate(context) {
        reqhomecate().then(res => {
            context.commit("changeCate", res.data.list)
        });
    },
    reqbanner(context) {
        reqhomebanner().then(res => {
            context.commit("changeBanner", res.data.list)
        })
    }
}
export default {
    state,
    getters,
    mutations,
    actions,
    namespaced: true
}